const Router = require("koa-router");
const router = new Router();
const captcha = require("trek-captcha");

let sessions = {};

router.get("/", async (ctx) => {
  console.log("hello");
  ctx.body = "hello captcha！";
  const { token, buffer } = await captcha({ size: 4 });
  // console.log(token, buffer);
  console.log(token);
  sessions.captcha = token;
  ctx.body = buffer;
});

module.exports = router;
